package com.appkubes.portal.core.service.impl;

//核心包
import com.appkubes.base.core.mbp.impl.AbstractBaseServiceImpl;
import com.appkubes.portal.core.dao.BasePortalGlobalAppMenuDao;
import com.appkubes.portal.core.entity.PortalGlobalAppMenu;
import com.appkubes.portal.core.service.BasePortalGlobalAppMenuService;

//依赖库
import com.appkubes.base.core.entity.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Primary
public class BasePortalGlobalAppMenuServiceImpl extends AbstractBaseServiceImpl<BasePortalGlobalAppMenuDao,PortalGlobalAppMenu> implements BasePortalGlobalAppMenuService {

    @Override
    public PortalGlobalAppMenu getOneByEntity(PortalGlobalAppMenu entity) {
        QueryWrapper<PortalGlobalAppMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.getOne(queryWrapper, false);
    }

    @Override
    public List<PortalGlobalAppMenu> selectListByEntity(PortalGlobalAppMenu entity) {
        QueryWrapper<PortalGlobalAppMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectList(queryWrapper);
    }
    
    @Override
    public IPage<PortalGlobalAppMenu> selectPageByEntity(IPage<PortalGlobalAppMenu> page) {
        PortalGlobalAppMenu PortalGlobalAppMenu = new PortalGlobalAppMenu();
        return selectPageByEntity(PortalGlobalAppMenu, page);
    }

    @Override
    public IPage<PortalGlobalAppMenu> selectPageByEntity(PageVO pageVO) {
        PortalGlobalAppMenu PortalGlobalAppMenu = new PortalGlobalAppMenu();
        return selectPageByEntity(PortalGlobalAppMenu, pageVO);
    }

    @Override
    public IPage<PortalGlobalAppMenu> selectPageByEntity(PortalGlobalAppMenu entity, IPage<PortalGlobalAppMenu> page) {
        QueryWrapper<PortalGlobalAppMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectPage(page, queryWrapper);
    }

    @Override
    public IPage<PortalGlobalAppMenu> selectPageByEntity(PortalGlobalAppMenu entity, PageVO pageVO) {
        return selectPageByEntity(entity, pageVO.getPage(), pageVO.getSize());
    }

    @Override
    public IPage<PortalGlobalAppMenu> selectPageByEntity(PortalGlobalAppMenu entity, Integer pageNo, Integer pageSize) {
        Page page = new Page<>(pageNo, pageSize);
        QueryWrapper<PortalGlobalAppMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.baseMapper.selectPage(page, queryWrapper);
    }

    @Override
    public Boolean removeByEntity(PortalGlobalAppMenu entity) {
        QueryWrapper<PortalGlobalAppMenu> queryWrapper = new QueryWrapper<>();
        queryWrapper.setEntity(entity);
        return this.remove(queryWrapper);
    }
}
